package Test.Exam;

import java.util.Scanner;

/**
 * @ClassName problem_1
 * @since: 2024/3/9 09:44
 * @auth: kirito
 * @description:
 **/
public class problem_4 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = in.nextInt();
        }

        int count = remove(arr, k);
//        for (int i = 0; i < n; i++) {
//            for (int j = i; j < n; j++) {
//                if (remove(arr, i, j, k)) {
//                    count++;
//                }
//            }
//        }
        System.out.println(count);


    }

    //    private static boolean remove(int[] arr, int start, int end, int k) {
//        int count_0 = 0;
//        long res = 1;
//        for (int l = start; l <= end; l++) {
//            res *= arr[l];
//            if (arr[l] % 5 == 0) {
//                count_0 += String.valueOf(arr[l]).length();
//            }
//
//        }
//        return (res % 10 == 0) && (count_0 >= k);
//    }
    private static int remove(int[] arr, int k) {
        int C = 0;
        for (int num : arr) {
            C += num / 5;
        }
        int count=0;
        for (int i = 0; i < arr.length; i++) {
            for (int j = i+1; j < arr.length; j++) {
                int removeCount = 0;
                int re = C;
                for (int l = i; l < j; l++) {
                    if (arr[l] % 5 == 0) {
                        re--;
                        removeCount++;
                    }

                }
                if (re - removeCount >= k) {
                    count++;
                }
            }

        }
        return count;
    }
}
